package com.jiukuaidao.library.util;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

import com.jiukuaidao.library.Config;

public class NetUtils {
    /**
     * 判断是否联网。
     *
     * @return boolean
     */
    public static boolean isNetworkConnected() {
        ConnectivityManager cm = (ConnectivityManager) Config.mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo ni = cm.getActiveNetworkInfo();

        return ni != null && ni.isConnectedOrConnecting();
    }

}
